/*
 * @Description: 线路信息数据模型
 * @Author: yingying.fan
 * @Date: 2019-05-14 18:30:55
 * @Last Modified by: yingying.fan
 * @Last Modified time: 2019-05-23 19:23:33
 */
export default class RouteInfoModel {
  /**
   *
   * @param {String} routeId 公交线路编号
   * @param {String} routeName 公交线路名称
   * @param {String} direction 线路方向
   * @param {Array} directionList 线路方向列表 1、上行；2、下行
   * @param {String} startStation 首站名称
   * @param {String} endStation 末站名称
   * @param {String} segmentId 线路上下行编号
   */
  constructor(
    routeId,
    routeName,
    direction = 1,
    directionList = [1],
    startStation,
    endStation,
    segmentId
  ) {
    this.routeId = routeId + ''
    if (escape(routeName).indexOf('%u') < 0) {
      // 路线名中如果没有中文则加上路
      this.routeName = `${routeName}路`
    } else {
      this.routeName = routeName + ''
    }
    this.direction = direction
    this.directionList = directionList
    this.startStation = startStation + ''
    this.endStation = endStation + ''
    this.segmentId = segmentId + ''
    this.price = '0.00'
  }

  /**
   * 设置站点数据
   * @param {Array} stationList
   */
  setStationList(stationList) {
    this.stationList = stationList
  }

  setRouteName(routeName) {
    this.routeName = routeName
  }
  setPrice(price) {
    this.price = price
  }
  setStartTime(startTime) {
    this.startTime = startTime
  }
  setEndTime(endTime) {
    this.endTime = endTime
  }
  setNextTime(nextTime) {
    this.nextTime = nextTime
  }
}
